<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    Object obj = request.getSession().getAttribute("user");//获取session,判断是否登录
    if (obj == null) {
        response.sendRedirect(request.getContextPath() + "/login.jsp");
    }
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/index.css">
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/font-awesome-4.7.0/css/font-awesome.min.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
</head>
<script>
    function myFunction() {
        alert("欢迎访问，功能正在完善中...");
    }
</script>
<body>
<div class="header">
    <h1>用户管理系统</h1>
    <a href="${pageContext.request.contextPath}/LogoutServlet"><i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
    <span>当前用户：${sessionScope.user.username }</span> <%--	 获取登录用户名--%>
</div>
<div class="container">
    <div class="container-nav">
        <div class="nav-top">
            <div class="fold-btn"><i class="fa fa-bars fa-2x"></i></div>
        </div>
        <ul>
            <li class="nav-item">
                <a href="${pageContext.request.contextPath}/adminList" target="mainframe">
                    <i class="fa fa-home fa-fw fa-lg"></i>
                    <span>首页</span></a>
            </li>
            <li class="nav-item">
                <a href="${pageContext.request.contextPath}/save.jsp" target="mainframe">
                    <i class="fa fa-file-text-o fa-fw fa-lg"></i>
                    <span>添加用户</span>
                </a>
            </li>
            <li class="nav-item">
                <a href="${pageContext.request.contextPath}/admininfopage" target="mainframe">

                    <i class="fa fa-cog fa-fw fa-lg"></i>
                    <span>分页数据</span>
                </a>
            </li>
            <li class="nav-item">
                <a href="javascript:;">
                    <i class="fa fa-book fa-fw fa-lg"></i>
                    <span onclick="myFunction()">系统管理
                  </span>
                </a>
            </li>
            <li class="nav-item"><a href="${pageContext.request.contextPath}/LogoutServlet"><i
                    class="fa fa-sign-out fa-fw fa-lg"></i> <span>退出登录</span></a></li>
        </ul>
    </div>
    <div class="container-main">
        <iframe name="mainframe" src="${pageContext.request.contextPath}/adminList" frameborder="0"
                style="width:100%;min-height:100%;background-color: #FFF;"></iframe>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        // nav收缩展开
        $('.nav-item>a').on('click', function () {
            if (!$('.nav').hasClass('nav-mini')) {
                if ($(this).next().css('display') == "none") {
                    //展开未展开
                    $('.nav-item').children('ul').slideUp(300);
                    $(this).next('ul').slideDown(300);
                    $(this).parent('li').addClass('nav-show').siblings('li').removeClass('nav-show');
                } else {
                    //收缩已展开
                    $(this).next('ul').slideUp(300);
                    $('.nav-item.nav-show').removeClass('nav-show');
                }
            }
        });
        //nav-mini切换
        $('.fold-btn').on('click', function () {
            $('.nav-item.nav-show').toggleClass('nav-show');
            // $('.nav-item').children('ul').removeAttr('style');
            $('.container').toggleClass("fold");
        });
    });
</script>
</body>
</html>